/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EDT.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author ali
 */
public class AjoutIntervenantForm extends org.apache.struts.action.ActionForm {
    
   private String key;
   private String nom;
   private String prenom;
   private String mail;
   private String tel;
    private int  status;
    
    private String pass;
    private String passcf;

    @Override
    public String toString() {
        return "AjoutIntervenantForm{" + "key=" + key + ", nom=" + nom + ", prenom=" + prenom + ", mail=" + mail + ", tel=" + tel + ", status=" + status + ", pass=" + pass + ", passcf=" + passcf + '}';
    }

    

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getPasscf() {
        return passcf;
    }

    public void setPasscf(String passcf) {
        this.passcf = passcf;
    }
    

    /**
     *
     */
    public AjoutIntervenantForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getNom() == null || getNom().length() < 1) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getPrenom() == null || getPrenom().length() < 1) {
            errors.add("prenom", new ActionMessage("error.prenom.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getMail() == null || getMail().length() < 1) {
            errors.add("email", new ActionMessage("error.email.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getTel() == null || getTel().length() < 1) {
            errors.add("tel", new ActionMessage("error.tel.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getPass() == null || getPass().length() < 1) {
            errors.add("pass", new ActionMessage("error.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        }
       
        if (getPasscf() == null || getPasscf().length() < 1) {
            errors.add("pass", new ActionMessage("error.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (!getPass().equals(getPasscf())) {
            errors.add("passconf", new ActionMessage("error.passconf.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }
}
